package guo.myapp.spitter;

import org.hibernate.validator.constraints.Email;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

public class Spitter {
    @NotNull
    @Size(min = 3,max = 15,message = "{firstname.size}")
    private String firstName;
    @NotNull
    @Size(min = 3,max = 15,message = "{lastname.size}")
    private String lastName;
    @NotNull
    @Size(min = 5,max = 30,message = "{username.size}")
    private String userName;
    @NotNull
    @Email(message = "{email.valid}")
    private String email;
    @NotNull
    @Size(min = 8,max = 20,message = "{password.size}")
    private String password;

    private Integer id;

    public Spitter() {
        id  = (int)Math.round(Math.random()*10000);
    }

    public Spitter(String userName, String password) {
        this.userName = userName;
        this.password = password;
    }

    public Spitter(String firstName, String lastName, String userName, String email, String password) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.userName = userName;
        this.email = email;
        this.password = password;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "Spitter{" +
                "firstName='" + firstName + '\'' +
                ", lastName='" + lastName + '\'' +
                ", userName='" + userName + '\'' +
                ", email='" + email + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
